/*滚动条事件*/
var tab = document.querySelector(".num");
window.onscroll = function(){
    if(document.body.scrollTop > 265 || document.documentElement.scrollTop > 265){
        tab.className = "container text-center relative fixed";
    }else {
        tab.className = "container text-center relative";
    }
};





/*倒计时*/
window.onload = function(){
    var time = {
        init: function() {
            var oTime = document.getElementById("time");
            var h='0' + 3;
            var m=59;
            var s=59;
            oTime.innerHTML="4 : 00 : 00";

            //进行倒计时显示
            var time = setInterval(function(){
                --s;
                if(s<0){
                    --m;
                    s=59;
                }
                if(m<0){
                    --h;
                    m=59
                }
                if(h<0){
                    s=0;
                    m=0;
                }
                // 判断当时分秒小于10时补0
                function checkTime(i){
                    if (i < 10) {
                        i = '0' + i
                    }
                    return i;
                }
                s = checkTime(s);
                m = checkTime(m);
                oTime.innerHTML=h+" : "+m+" : "+s;
            },1000);
        }
    };
    time.init();
};






//json数据
new Vue({
    el: '#app',
    data: {
        message:"请求数据"
    },
    mounted(){
        axios
            .get("json/new.json")
            .then(response => this.message = response.data.linkes)
            .catch(function(error){
                console.log(error);
        })
    }
});

new Vue({
    el: '#app1',
    data: {
        message:"请求数据"
    },
    mounted(){
        axios
            .get("json/new.json")
            .then(response => this.message = response.data.linkese)
            .catch(function(error){
                console.log(error);
            })
    }
});

new Vue({
    el: '#app2',
    data: {
        message:"请求数据"
    },
    mounted(){
        axios
            .get("json/new.json")
            .then(response => this.message = response.data.linke)
            .catch(function(error){
                console.log(error);
            })
    }
});
new Vue({
    el: '#app3',
    data: {
        message:"请求数据"
    },
    mounted(){
        axios
            .get("json/new.json")
            .then(response => this.message = response.data.link)
            .catch(function(error){
                console.log(error);
            })
    }
});
new Vue({
    el: '#app4',
    data: {
        message:"请求数据"
    },
    mounted(){
        axios
            .get("json/new.json")
            .then(response => this.message = response.data.lin)
            .catch(function(error){
                console.log(error);
            })
    }
});
//选项卡
var tabs = document.querySelectorAll(".tab-menu li");
var tab_box = document.querySelectorAll(".tab-box > div");

for(var i = 0 ; i <tabs.length;i++){
    tabs[i].onclick = linem;
}
function linem(){
    for(var i = 0 ; i<tabs.length ; i++){
        if(tabs[i] === this){
            tabs[i].className = "active";
            tab_box[i].style.display = "block";
        }else {
            tabs[i].className = "";
            tab_box[i].style.display = "none";
        }
    }
}







































new Vue({
    el:"#paa",
    data:{
        list:[
            {span1:"*小米秒杀活动规则："},
            {span2:"1.秒杀商品是否参加活动，以订单结算页显示为准，活动包括但不限于优惠券、赠品、满减、满赠等；"},
            {span3:"2.秒杀商品数量有限，活动以下单支付成功为准，请加入购物车后尽快下单支付；"},
            {span4:"3.秒杀价不含运费，最终以订单结算页价格为准。"},
            {span5:"温馨提示：因可能存在系统缓存、页面更新导致价格变动异常等不确定性情况出现，如您发现活动商品标价或促销信息有异常，请您立即联系小米客服，以便我们及时补正。"}
        ]
    }
});